package javawork02;

import java.util.Random;

public class homework04 {
	public static void main(String[] args){
		Random r=new Random();
		int num=0;
		int a=0;
		int[][] arr1={{1,2},{3,4,5,6},{7,8,9,10}};
		int[] arr2=new int[10];
		for (int i=0;i<arr1.length;i++){
			for(int j=0;j<arr1[i].length;j++){
					arr2[a]=arr1[i][j];
					a++;
			}
		}
		for(int i=0;i<arr2.length;i++){
			int temp=arr2[i];
			//获取一个随机数字
			num = r.nextInt(arr2.length);
			arr2[i]=arr2[num];
			arr2[num]=temp;
		}
		int a1=0;
		for (int i=0;i<arr1.length;i++){
			for(int j=0;j<arr1[i].length;j++){
					arr1[i][j]=arr2[a1];
					a1++;
			}
		}
		System.out.print("[");
		for(int i=0; i<arr1.length;i++){
			System.out.print("{");
			if (i==arr1.length)
				System.out.print("}");
			for (int j=0; j<arr1[i].length;j++){
				if (j<arr1[i].length-1)
					System.out.print(arr1[i][j]+",");
				else if(i==arr1.length-1)
					System.out.print(arr1[i][j]+"}]");
				else
					System.out.print(arr1[i][j]+"},");
			}
			
		}
	}
}
